// miniprogram/pages/patient/caseList.js
const pageNumer=1
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    list: [],
    suggestShow:false,
    suggest:''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(app.globalData.cases)
    app.globalData.cases.where({
      _openid: app.globalData.openid,
    })
    .get()
    .then(res => {
      this.setData({
      list:res.data
      })
    })
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  viewResult:function(e){
    let caseId = e.currentTarget.dataset._id
    let suggest=''
    this.data.list.forEach(item=>{
      if (item._id == caseId) this.setData({suggest: item.doctorTreatment})
    })
    this.setData({
      suggestShow:true
    })
  },

  closeDialog:function(){
    this.setData({
      suggestShow: false
    })
  },

  goPatient: function(){
    wx.navigateTo({
      url: 'patient',
    })
  }
})